<!DOCTYPE html>
<html lang="en">
<body>
	<div id="div1">I am a div</div>
	<div id="div2">I am a div</div>
	<div id="div3">I am a div</div>
	<script
		src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script>
		(function($) {
			// Alerts attribute value for first element in wrapper set     
			alert($('div').attr('id')); // Alerts "div1" 
		})(jQuery);
	</script>
</body>
</html>